/*
 Copyright (c) 2023 wagyingming  All rights reserved.
 Use of this source code is governed by a BSD-style
 license that can be found in the LICENSE file.
 */
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <argp.h>
#include <time.h>
#include <sys/resource.h>
#include <bpf/libbpf.h>
#include <bpf/bpf.h>

#define USER_PROC
#include "../../include/struct.h"
#include "lsm_permission.skel.h"
#include "../../include/bpf_map.h"
#include "../../include/config.h"
#include "../../include/audit.h"
#include "../../include/policy.h"
#include "./lsm_permission_tracker.h"

volatile int exiting = 0;

static void sig_handler(int sig)
{
    exiting = 1;
}

int main(int argc, char **argv)
{
    struct lsm_permission_bpf *skel = NULL;
    struct lsm_permission_env lsm_permission_env;
    signal(SIGINT, sig_handler);
    signal(SIGTERM, sig_handler);
    lsm_permission_env.exiting = &exiting;
    return start_lsm_permission_tracker(lsm_permission_env, skel, NULL);
}
